[ sample array testing code, demonstrating how arrays work]
(function test-array
variable ar x y z do
[ you set arrays by calling make-array. This example
sets up a 3x4x5 array. make-array returns a pointer
(a string) to the array. You can then set a variable
to "be" that array. As in the variable ar below. ]
(set ar (make-array 3 4 5))
(print ar) [ take a look on the screen ]
[ next, let's set some values. We'll set each cell
in the array to a string value describing its
relative position. You do this with set-array,
passing it the array variable holding the pointer,
the value you want to set, and the coordinates.
Easy enough...]
(for x 1 3 1
(for y 1 4 1
(for z 1 5 1
(set-array ar (concatenate x " " y " " z) x y z))))
[ okay, let's see what we did. Print out values
through "array", passing it the array pointer
and coordinates of the needed value. ]
(for x 1 3 1
(for y 1 4 1
(for z 1 5 1
(print (array ar x y z)))))
[ ...and lastly, free the array. Remember memory leaks!
this interpreter doesn't do garbage collection, guys ]
(free-array ar)
)
[sample ipc code. This consists of three functions: cows-ipc-example, cows2-synchronous, and cows2-asynchronous. Load cows-ipc-example on COWS.app, and the two cows2 functions on COWS2.app. Then call cows-ipc-example and see what happens.]
(function cows-ipc-example variable x do
(print
"I sent COWS2 the value 100 and got back: "
(set x (send "COWS2" "cows2-synchronous" 100))
"Nifty, huh?"
"Now, I'm gonna just tell COWS2 to print what I got back.")